<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<script>
	function goBack() {
		history.go(-1);
	}
	function check(){
		var c = document.getElementById("re_content").value;
		if(c == ''){
			alert("댓글을 입력해 주세요");
			return false;
		}
	}
</script>
<table width="100%" border="0" cellspacing="0" align="center">
	<tr>
		<td colspan="6">
			<hr size="3" width="100%" noshade>
		</td>
	</tr>
	<tr>
		<td><font size="4px">제목</font></td>
		<td><font color="#2F4F4F">${board.bo_title}</font></td>	
		<td><font size="4px">번호</font></td>
		<td><font color="0000FF">${board.bo_num}</font></td>
		<td></td>
		<td></td>
	</tr>
	<tr>
		<c:if test="${board.category == 'yagu' }">
			<td><font size="4px">팀명:</font></td>
			<td><font color="#FF4500">${board.team_name}</font></td>
		</c:if>
	</tr>
	<tr>
		<td><font size="4px">아이디:</font></td>
		<td><font color="#FF0000">${board.bo_id}</font></td> 
		<td><font size="4px">작성일:</font></td>
		<td><font color="#0000FF">&nbsp;${board.bo_today}</font></td>
		<td><font size="4px">조회수:</font></td>
		<td><font color="#FF4500">&nbsp;${board.bo_count}</font></td>
	
	</tr>
	<tr>
		<td colspan="6">
			<hr size="3" width="100%" noshade>
		</td>
	</tr>
	
	<tr>
	<td>내용</td>
	<td>${board.bo_content}</td>
	</tr>
	<tr>
		<td colspan="6"><c:if test="${!empty board.bo_image }">
				<img src="../upload/${board.bo_image }" style="max-width: 100%; height: auto;">
				<br>
			</c:if></td>
	</tr>
	<tr>
		<td colspan="6">
			<hr size="3" width="100%" noshade>
		</td>
	</tr>
	<tr>
		<table width="90%" border="0" cellspacing="0" cellpadding="0">
		<tr bgcolor="#FAF8E6">
			<td width="5%" >번호</font></td>
			<td width="10%">ID</font></td>
			<td width="70%">내용</font></td>
			<td width="15%">날짜</font></td>
			<td></td>
		</tr>
		<c:forEach var="reply" items="${replylist}">
			<tr bgcolor="#FAF8E6">
				<td "#FAF8E6">${reply.re_num}</td>
				<td>${reply.re_id}</td>
				<td>${reply.re_content}</td>
				<td>${reply.re_date}</td>
				<c:if test="${userId == reply.re_id || userId == 'admin'}">
			<td><input type="button" value="삭제" onclick="location.href='deletereply.do?re_num=${reply.re_num}&bo_num=${board.bo_num}'"></td>
				</c:if>
			</tr>
		</c:forEach>
	</table>
	</tr>
	<br><br><br><br><br>
	<tr>
	<table width="900" border="0" cellspacing="0" cellpadding="0" align="center">
		<!-- <tr bgcolor="#F3F3F3">
			<td width="200"></td>
			<td width="500"></td>
		</tr> -->
	<tr>
	<form name="myForm2" action="boardreplywrite.do" method="post" onsubmit="return check()">
	<input type="hidden" id="bo_num" name="bo_num" value="${board.bo_num}"/>
	<input type="hidden" name="re_id" value="${userId}"/>
		<td>작성자 :</td> 
		<td>${userId}</td>
	<!-- <td><input id="re_content" type="text" name="re_content"></td> -->		
	<td><textarea rows="5" cols="100" id="re_content" name="re_content"></textarea></td>
	<td><input type="submit" value="댓글입력"/></td>
	</form>
	</tr>
	</table>
	</tr>
	
	<table align="center">
	<tr>
		<td align="right" colspan="2">
		
			<c:if test="${userId == board.bo_id || userId == 'admin'}">
			<input type="button" value="수정" onclick="location.href='update.do?bo_num=${board.bo_num}&category=${board.category}&team_no=${board.team_no}'">	
			<input type="button" value="삭제" onclick="location.href='delete.do?bo_num=${board.bo_num}&category=${board.category}&team_no=${board.team_no}'">
			</c:if>
<!-- 			<input type="button" value="목록" onclick="goBack()"> -->
			<input type="button" value="목록" onclick="location.href='list.do?category=${board.category}&team_no=${board.team_no}'">
		</td>
	</tr>
	</table>
</table>